Fix missing comma in @_expose attribute for SwiftSyntax602#555
Merged
kateinoigakukun merged 7 commits intoswiftwasm:mainfrom Feb 3, 2026
Merged
Conversation
The SwiftSyntax602 code path in `buildExposeAttributes` was using array literal syntax to construct `LabeledExprListSyntax`, which doesn't set `trailingComma` on the AST nodes. This resulted in malformed attributes: `@_expose(wasm "name")` instead of `@_expose(wasm, "name")`. The fix uses the result builder syntax with explicit `.with(\.trailingComma, .commaToken())` to ensure the comma is present in the generated code. Also adds a dedicated `bridgejs-test` CI job that tests BridgeJS with multiple Swift/SwiftSyntax version combinations to ensure both code paths (pre-602 and 602+) are exercised: - Swift 6.0.3 with SwiftSyntax 600.0.1 - Swift 6.1.2 with SwiftSyntax 601.0.1 - Swift 6.2 with SwiftSyntax 602.0.0 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove sed-based version pinning that caused linker errors on Swift 6.2. Swift 6.2 ships with prebuilt SwiftSyntax 602.0.0, and forcing an exact version caused duplicate symbol errors during linking. Each Swift version naturally resolves to compatible SwiftSyntax: - Swift 6.0.x → SwiftSyntax 600.x - Swift 6.1.x → SwiftSyntax 601.x - Swift 6.2.x → SwiftSyntax 602.x Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The codebase uses trailing commas in argument lists (BridgeJSToolInternal.swift) which requires Swift 6.1+. Testing with 6.1.2 and 6.2 covers both SwiftSyntax code paths (non-602 and 602). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
On Swift 6.2, SPM resolves to SwiftSyntax 600.0.1 by default (per Package.swift), which doesn't have the SwiftSyntax602 module. Use sed to temporarily force SwiftSyntax 602.x so we actually test the SwiftSyntax602 code path. This also may avoid the prebuilt binary linker conflicts that occur with SwiftSyntax 600.0.1 on Swift 6.2. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
83a275e to
339725a
Compare
kateinoigakukun
approved these changes
Feb 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@_expose(wasm, ...)attribute when using SwiftSyntax602 code pathProblem
The SwiftSyntax602 code path in
buildExposeAttributeswas using array literal syntax to constructLabeledExprListSyntax, which doesn't settrailingCommaon the AST nodes. This resulted in malformed attributes:Solution
Use the result builder syntax with explicit
.with(\.trailingComma, .commaToken())to ensure the comma is present in the generated code.You can check new AST in Swift 6.2 (602 syntax) in https://swift-ast-explorer.com/
Test Coverage
Added a dedicated
test-bridgejs-against-swift-versionsCI job that tests BridgeJS with multiple Swift/SwiftSyntax version combinations to ensure both code paths are exercised:Test plan
🤖 Generated with Claude Code